TrimLeft (str)

TrimLeft and LTrim (str) are equivalent functions. However, TrimLeft is preferred in Crystal syntax, whereas LTrim is preferred in Basic syntax.

Arguments

str is a string.

Returns

Text String

Action

TrimLeft removes all spaces to the left of a string or data field which is stored as a right-justified string in a database.

Typical uses
Examples

The following examples are applicable to both Basic and Crystal syntax, although LTrim is preferred in the latter:

TrimLeft("    Al/4520/B12")

Returns "A1/4520/B12".

TrimLeft("    200")

Returns "200", where the text string "200" is right-justified with leading blanks.

You have two right-justified database fields, {file.FOOD1} and {file.FOOD2}. Each field can hold up to 15 characters. {file.FOOD1} contains the word bread and {file.FOOD2} contains the word butter. If you were to print these words, they would appear like this:

"          bread"

"         butter"

For each 15-character field the database includes the field value, right-justified plus enough blank spaces to fill up the field. To use these words without the leading spaces (to create the expression bread and butter, for example) use the TrimLeft function in the following manner:

TrimLeft({file.FOOD1}) + " and " + TrimLeft({file.FOOD2})

Returns "bread and butter".

The spaces enclosed in the quotation marks before and after the word and assure that there is the correct spacing between the three words in the resulting sentence.

Related topics

Trim (str)

TrimRight (str)

Formula 14



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com